home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
8bitfiles.net/archives
/
archives.tar
/
archives
/
commodore-users-of-norman
/
CUON_06_(08-1984).d64
/
othello ii
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2019-04-13
|
5KB
|
167 lines
1 PRINT"[147]"SPC(16)"REVERSAL":PRINTSPC(13)"COPYRIGHT 1978"
3 PRINTSPC(4)"COMMODORE BUSINESS MACHINES INC":FORI=1TO1000:NEXT
5 FORI=1TO39:E$=E$+" ":NEXT:FORJ=1TO39:E$=E$+"[157]":NEXT:N$="12345678"
7 D$="":FORI=1TO20:D$=D$+"":NEXT:DIMA(9,9),I4(7),J4(7):F2=3:B=-1:W=1:M$="[215] [209]"
9 FORK=0TO7:READI4(K),J4(K):NEXT:PRINT"[147]GREETINGS FROM REVERSAL
11 [141]251:[141]231:P[178]6:N$(B[170]1)[178]"BLACK":N$(W[170]1)[178]"WHITE
13 PRINT"DO YOU WANT TO PLAY THE PET[146] ? ";:GOSUB131
15 IFX$="N"THENPRINT"NO":GOTO37
17 IFX$<>"Y"THENGOSUB131:GOTO15
19 PRINT"YES":F2=3:PRINT"SHOULD I PLAY MY BEST ? ";:GOSUB131
21 IFX$="N"THENPRINT"NO[146]":GOTO27
23 IFX$<>"Y"THENGOSUB131:GOTO21
25 PRINT"YES":S2=2:S4=1:S5=-1.5
27 PRINT"BLACK ALWAYS GOES FIRST.":PRINT"DO YOU WANT BLACK OR WHITE[146] ? ";:GOSUB131
29 IFX$="B"THENPRINTN$(0):N$(2)="PET":GOTO35
31 IFX$<>"W"THENGOSUB131:GOTO29
33 PRINTN$(2):N$(0)="PET":F2=2
35 GOSUB329
37 PRINT"[147]";:GOSUB107:IFF2=2THENPRINT"OK, I AM THINKING!"
39 T1=B:T2=W:ONF2GOSUB151,181,151:GOSUB225:IFZ=1THEN43
41 BC=BC+S1+1:WC=WC-S1:N1=N1+1:GOSUB107
43 IFWC=0ORN1=64ORZ<0THEN53
45 T1=W:T2=B:ON F2GOSUB151,151,181:GOSUB225:IFZ=1THEN49
47 WC=WC+S1+1:BC=BC-S1:N1=N1+1:GOSUB107
49 IFBC=0ORN1=64ORZ<0THEN53
51 GOTO39
53 SN=SM
55 PRINTD$;E$:PRINTE$:PRINTE$:PRINTD$;E$"BLACK HAS"BC"AND WHITE[146] HAS"WC"PIECES."
57 IFBC=WCTHENPRINT"A TIE !!":GOTO77
59 PRINT"[209][215][209][215][209][215][209][215] ";:IFBC>WCTHENPRINT"BLACK";:GOTO63
61 PRINT"WHITE[146]";
63 PRINT" WINS !":CC=BC-WC:IFCC<0THENCC=-CC
65 CC=(64*CC)/N1:PRINT"THAT WAS A ";
67 IFCC<11THENPRINT"SQUEAKER !":GOTO77
69 IFCC<25THENPRINT"HOT GAME !":GOTO77
71 IFCC<39THENPRINT"FIGHT.":GOTO77
73 IFCC<53THENPRINT"WALKAWAY.":GOTO77
75 PRINT"PERFECT GAME."
77 PRINT"DO YOU WANT A REPLAY OF THE GAME? ";:GOSUB131:IFX$="N"THENPRINT"NO";:GOTO81
79 PRINT"YES";:GOSUB233:GOSUB237:GOSUB55
81 PRINTD$""E$"DO YOU WANT TO START THE GAME ? ";
83 GOSUB131:IFX$="Y"THENPRINT"YES";:GOSUB329:PRINT"[147]";:GOTO11
85 PRINT"NO";:END
87 F1=0:FORI1=-1TO1:FORJ1=-1TO1:IFA(I+I1,J+J1)=T2THEN91
89 NEXTJ1,I1:RETURN
91 F1=1:RETURN
93 S1=0:FORK=0TO7:I5=I4(K):J5=J4(K):I6=I+I5:J6=J+J5:S3=0:IFA(I6,J6)<>T2THEN105K
95 S3=S3+1:I6=I6+I5:J6=J6+J5:IFA(I6,J6)=T1THEN101
97 IFA(I6,J6)=0 THEN105
99 GOTO95
101 S1=S1+S3:IFU<>1THEN105
103 I6=I:J6=J:FORK1=0TOS3:A(I6,J6)=T1:I6=I6+I5:J6=J6+J5:NEXTK1
105 NEXTK:RETURN
107 PRINT""SPC(10)" R E V E R S A L [146]":X$=" [171][192][192][192][219][192][192][192][219][192][192][192][219][192][192][192][219][192][192][192][219][192][192][192][219][192][192][192][219][192][192][192][179]"
109 PRINTE$" A B C D E F G H"
111 PRINT" [176][192][192][192][178][192][192][192][178][192][192][192][178][192][192][192][178][192][192][192][178][192][192][192][178][192][192][192][178][192][192][192][174]":FORI=1TO8:PRINTMID$(N$,I,1)" [221] ";
113 FORJ=1TO8:PRINTMID$(M$,A(I,J)+2,1)" [221] ";:NEXTJ:PRINT:IFI<>8THENPRINTX$
115 NEXTI:PRINT" [173][192][192][192][177][192][192][192][177][192][192][192][177][192][192][192][177][192][192][192][177][192][192][192][177][192][192][192][177][192][192][192][189]":RETURN
117 I=-1:J=I:FORK=1TO2:GOSUB131:G=ASC(X$):IF47<GANDG<58THENI=G-48:GOTO123
119 IF64<GANDG<74THENJ=G-64:GOTO123
121 NEXT:RETURN
123 PRINT""X$"[146] ";:NEXT:RETURN
125 PRINTLEFT$(D$,2*(I-1)+5);SPC(4*(J-1)+4);:X$=MID$(M$,T1+2,1):FORK=1TOP
127 PRINT" [157]";:FORL=1TO200:NEXT:PRINTX$"[157]";:FORL=1TO200:NEXT:NEXT:RETURN
129 PRINTX$"[157]";:FORL=1TO200:NEXT:NEXT:RETURN <
131 FORL=1TO10:GETA$:NEXT
133 L=0:PRINT"[166][157]";
135 L=L+1:GETX$:IFX$<>""THENRETURN
137 IFL<20THEN135
139 PRINT" [157]";
141 L=L+1:GETX$:IFX$<>""THENRETURN
143 IFL<40THEN141
145 GOTO133
147 PRINTD$""E$"BAD MOVE[146] INPUT ROW 0[146]-8[146] AND COL A[146]-H[146]":PRINTE$;
149 GOSUB251:IFF1>1THENGOSUB107
151 REM MOVE INPUT SUBROUTINE
153 PRINTD$;E$"INPUT "N$(T1+1)"'S[146] MOVE -- ";:GOSUB117
155 IFI<0ORJ<0ORI>8ORJ>8THEN147
157 IFI<>0THEN167
159 G2=S2:G4=S4:G5=S5:S2=0:S4=0:S5=0:GOSUB197:S2=G2:S4=G4:S5=G5:IFB1<0THEN163
161 PRINTD$""E$"NO FORFEIT ALLOWED. "N$(T1+1)"[146] HAS A MOVE.":GOTO177
163 IFZ=1THENZ=-Z:RETURN
165 Z=1:RETURN
167 IF A(I,J)=0THEN171
169 PRINTD$""E$"SORRY,SQUARE OCCUPIED BY "N$(A(I,J)+1):GOTO177
171 GOSUB87:IFF1=1THEN175
173 PRINTD$""E$"SORRY,NOT NEXT TO "N$(T2+1)"'S[146] PIECES":GOTO177
175 U=-1:GOSUB93:IFS1>0THEN179
176 PRINTD$""E$"SORRY,DOES NOT CONTAIN "N$(T2+1)
177 PRINTE$:GOTO153
179 GOTO193
181 GOSUB197:IFB1>0THEN191
183 IFS5=0THEN187
185 S5=0:GOTO181
187 PRINTD$""E$N$(T1+1)"[146] FORFEITS MOVE":IFZ=1THENZ=-Z:RETURN
189 Z=1:RETURN
191 I=I3:J=J3
193 PRINTD$""E$;N$(T1+1)"[146] MOVES TO "CHR$(I+48)"[146] "CHR$(J+64):GOSUB125:Z=0:U=1
195 GOSUB93:PRINTD$""E$"THAT GIVES "N$(T1+1)"[146]"S1"OF "N$(T2+1)"'S[146] PIECES":RETURN
197 B1=-1:I3=0:J3=0:FORI=1TO8:FORJ=1TO8:IFA(I,J)<>0THEN223
199 GOSUB87:IFF1=0THEN223
201 U=-1:GOSUB93:IFS1=0THEN223
203 IF(I=1)OR(I=8)THENS1=S1+S2
205 IF(J=1)OR(J=8)THENS1=S1+S2
207 IF(I=2)OR(I=7)THENS1=S1+S5
209 IF(J=2)OR(J=7)THENS1=S1+S5
211 IF(I=3)OR(I=6)THENS1=S1+S4
213 IF(J=3)OR(J=6)THENS1=S1+S4
215 IFS1<B1THEN223
217 IFS1>B1THEN221
219 IFRND(1)>0.5THEN223
221 B1=S1:I3=I:J3=J
223 NEXTJ,I:RETURN
225 L=((T1+1)*64)AND128:IFZ<>0THENL=LOR64:GOTO229
227 L=LOR((((I-1)*8)AND56)OR(J-1AND7))
229 POKESM,L:SM=SM+1:RETURN
231 BC=2:WC=BC:N1=4
233 FORI=0TO9:FORJ=0TO9:A(I,J)=0:NEXTJ,I:A(4,4)=W:A(5,5)=W:A(4,5)=B:A(5,4)=B
235 Z=0:F2=1:S2=0:S4=0:S5=0:SM=826:RETURN
237 PRINT"[147] REPLAY"SPC(21)"REPLAY":P=3:FORD=826TOSN-1:GOSUB107:L=PEEK(D)
239 I=1+(LAND56)/8:J=1+(LAND7):T1=B:T2=W:IFLAND128THENT1=W:T2=B
241 IF(LAND64)=0THEN245
243 PRINTD$E$:PRINTE$:PRINTE$:PRINTD$""N$(T1+1)"[146] FORFEITS A MOVE":FORL=1TO2000:NEXT:GOTO247
245 GOSUB193
247 NEXT
249 GOTO107
251 F1=0:PRINT"DO YOU WANT INSTRUCTIONS ? ";:GOSUB131
253 IFX$="N"THENPRINT"NO":RETURN
255 IFX$<>"Y"THENGOSUB131:GOTO253
257 PRINT"YES":FORF1=1TO1000:NEXT
259 PRINT"[147]REVERSAL[146] IS PLAYED ON AN 8 X 8 BOARD,"
261 PRINT"ROWS NUMBERED 1[146] TO 8[146] AND COLUMNS A[146] TO H[146]"
263 PRINT"THE OBJECT OF THE GAME IS TO CAPTURE AS"
265 PRINT"MANY OF THE OPPONENT'S PIECES AS"
267 PRINT"POSSIBLE. TO CAPTURE PIECES,TRY TO"
269 PRINT"PLACE YOUR PIECE SO THAT A HORIZONTAL,"
271 PRINT"VERTICAL OR DIAGONAL LINE OF YOUR"
273 PRINT"OPPONENT'S PIECES WILL BE CONTAINED ON"
275 PRINT"BOTH SIDES BY YOUR'S."
277 PRINT" [192][192][192][219][192][192][192][219][192][192][192][219][192][192][192][219][192][192][192][219][192][192][192]"
279 PRINT" [221] [215] [221] [215] [221] [215] [221] [215] [221] [209]"
281 PRINT" [192][192][192][219][192][192][192][219][192][192][192][219][192][192][192][219][192][192][192][219][192][192][192]"
283 PRINT"EXAMPLE: WHITE CONTAINS BLACK,"
285 PRINT"CAPTURING FOUR OF BLACK'S PIECES."
287 PRINT"HIT 'RETURN' TO CONTINUE"
289 PRINT"[145][145][145][145][145][145]";
291 FORL=1TO10:GETA$:NEXT
293 PRINT"[209][157]";:FORL=1TO200:NEXT
295 PRINT" [157]";:FORL=1TO200:NEXT
297 GETX$:IFX$=""THEN293
299 PRINT"[209] [221][160][209] [221] [209] [221] [209] [221] [209]"
301 PRINT"MAKE YOUR MOVE BY ENTERING:
303 [153]" A NUMBER 1WAIT-8WAIT FOR THE ROW
305 PRINT" AND A LETTER A[146]-H[146] FOR THE COLUMN.
307 [153]"NOTE: YOU MUST CAPTURE AT LEAST ONE
309 PRINT"PIECE PER TURN IF IT IS AT ALL
311 [153]"POSSIBLE. IF IT IS NOT POSSIBLE, YOU
313 PRINT"FORFEIT YOUR TURN BY ENTERING 0[146] A[146] FOR
315 [153]"YOUR MOVE.
317 PRINT"HIT 'RETURN' TO CONTINUE
319 [129]L[178]1[164]10:[161]A$:[130]
321 [161]X$:[139]X$[178]""[167]321
323 [153]"LOAD";:[142]
325 [142]
327 [131] 0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1
329 [129]L[178]1[164]1000:[130]:[142]